package com.zq.zhufengfm.tasks.discover;

import com.zq.zhufengfm.Constants;
import com.zq.zhufengfm.client.ClientApi;
import com.zq.zhufengfm.tasks.BaseTask;
import com.zq.zhufengfm.tasks.TaskCallback;
import com.zq.zhufengfm.tasks.TasklResult;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Project_name : ZhuFengFM
 * Author : zhaoQiang
 * Email : 229457269@qq.com
 * Create_time : 2015/10/20 | 17:45
 */
public class DiscoverREcommendTask extends BaseTask {

    public DiscoverREcommendTask(TaskCallback taskCallback){
        super(taskCallback);
    }

    @Override
    protected TasklResult doInBackground(String... params) {
        TasklResult ret = new TasklResult();

        ret.action = Constants.TASK_ACTION_DISCOVER_RECOMMENDS;

        JSONObject jsonObject = ClientApi.getDiscoverRecommed("and-f6", true, true);

        if (jsonObject != null) {

            try {
                ret.resultCode = jsonObject.getInt("ret");

                //解析数据：
                ret.data = jsonObject;

            } catch (JSONException e) {
                e.printStackTrace();
            }

        }
        return ret;
    }
}
